<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-audit-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">监测点名称：</label>
                <div class="col-sm-8">
                    <select name="moniterId" class="form-control"   id="moniterId">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">因子名称：</label>
                <div class="col-sm-8">
                    <select name="factorId" class="form-control"   id="factorId">
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">最大值：</label>
                <div class="col-sm-8">
                    <input name="maxValue" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">最小值：</label>
                <div class="col-sm-8">
                    <input name="minValue" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "bus/audit"
        $("#form-audit-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-audit-add').serialize());
            }
        }

        $(document).ready(function(){
            loadMonitorName();
        });
        function loadMonitorName() {
            $.ajax({
                url:  "/bus/monitor/list",
                type: "post",
                success: function (data) {
                    var nameOpt = "<option value='' selected='selected'>--请选择--</option>";
                    for (var i = 0; i < data.rows.length; i++) {
                        nameOpt += "<option value='" + data.rows[i].monitorId + "' >" + data.rows[i].monitorName + "</option>"
                        $('#moniterId').html(nameOpt);
                    }
                }
            });
        };

        $(document).ready(function(){
            loadFactorID();
        });
        function loadFactorID() {
            $.ajax({
                url:  "/bus/factor/list",
                type: "post",
                success: function (data) {
                    var nameOpt = "<option value='' selected='selected'>--请选择--</option>";
                    for (var i = 0; i < data.rows.length; i++) {
                        nameOpt += "<option value='" + data.rows[i].factorId + "' >" + data.rows[i].factorName + "</option>"
                        $('#factorId').html(nameOpt);
                    }
                }
            });
        };
    </script>
</body>
</html>